window.renderSoldOutRate = (chart, rate) => {

    var option = {
        title: {
            // text: '本日商品售罄率',

            left: 0,
            top: 0,
            textStyle: {
                color: '#ccc'
            }
        },
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
        },
        series: [
            {
                name:'售罄',
                type:'pie',
                radius: [45, 70],
                avoidLabelOverlap: true,
                label: {
                    normal: {
                        show: true,
                        textStyle: {
                            fontSize: '20',
                            fontWeight: 'bold'
                        },
                        position: 'center'
                    },
                    // emphasis: {
                    //     show: true,
                    //     textStyle: {
                    //         fontSize: '30',
                    //         fontWeight: 'bold'
                    //     }
                    // }
                },
                data:[
                    {
                        value: Math.round(rate * 100),
                        name: `${Math.round(rate * 100)} %`,
                        itemStyle: {
                            normal: {
                                color: "#ff674f",
                            }
                        },
                    },
                    {
                        value: Math.round((1-rate) * 100),
                        name: ' ',
                        itemStyle: {
                            normal: {
                                color: "#50a7f8",
                            }
                        },
                    },
                ],
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    chart.setOption(option);
};